﻿@model ConfigurationModel

@{
    Layout = "_ConfigurePlugin";
}

@await Component.InvokeAsync("StoreScopeConfiguration")
@await Component.InvokeAsync("SettingMode")

<form asp-controller="PayPalSmartPaymentButtons" asp-action="Configure" method="post">
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <p>
                    You must set up your development environment to get OAuth 2.0 client ID and secret credentials for the sandbox and live environments.<br />
                    Follow these steps to generate REST API credentials:<br />
                    1. <a href="https://developer.paypal.com/developer/applications" target="_blank">Log into the Developer Dashboard</a> with your PayPal account credentials. If you don't have an account, you can click on the <b>sign up</b> option.<br />
                    2. On <b>My Apps & Credentials</b>, use the toggle to switch between live and sandbox testing apps.<br />
                    3. Navigate to the <b>REST API apps</b> section and click <b>Create App</b>.<br />
                    4. Type a name for your app and click <b>Create App</b>. The app details page opens and displays your credentials.<br />
                    5. Copy and save the client ID and secret for your app.<br />
                    6. Review your app details and save your app.<br />
                    <br />
                </p>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="UseSandbox_OverrideForStore" asp-input="UseSandbox" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="UseSandbox" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="UseSandbox" />
                        <span asp-validation-for="UseSandbox"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="ClientId_OverrideForStore" asp-input="ClientId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="ClientId" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="ClientId" asp-required="true" />
                        <span asp-validation-for="ClientId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="SecretKey_OverrideForStore" asp-input="SecretKey" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="SecretKey" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="SecretKey" asp-required="true" asp-value="@Model.SecretKey" />
                        <span asp-validation-for="SecretKey"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="PaymentTypeId_OverrideForStore" asp-input="PaymentTypeId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="PaymentTypeId" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="PaymentTypeId" asp-items="Model.PaymentTypes" />
                        <span asp-validation-for="PaymentTypeId"></span>
                    </div>
                </div>
                <div class="panel panel-default advanced-setting">
                    <div class="panel-heading">
                        @T("Plugins.Payments.PayPalSmartPaymentButtons.Prominently")
                    </div>

                    <script>
                        $(document).ready(function () {
                            $("#@Html.IdFor(model => model.DisplayLogoInHeaderLinks)").click(toggleDisplayLogo);
                            $("#@Html.IdFor(model => model.DisplayLogoInFooter)").click(toggleDisplayLogo);

                            toggleDisplayLogo();
                        });

                        function toggleDisplayLogo() {
                            if ($('#@Html.IdFor(model => model.DisplayLogoInHeaderLinks)').is(':checked')) {
                                $('#pnlLogoInHeaderLinks').show();
                            }
                            else {
                                $('#pnlLogoInHeaderLinks').hide();
                            }

                            if ($('#@Html.IdFor(model => model.DisplayLogoInFooter)').is(':checked')) {
                                $('#pnlLogoInFooter').show();
                            }
                            else {
                                $('#pnlLogoInFooter').hide();
                            }
                        }
                    </script>

                    <div class="panel-body">
                        <p>
                            Build customer trust with PayPal branding on your website.<br />
                            Feature the PayPal button on all pages that initiate checkout. Including PayPal branding early in the checkout experience helps increase site conversion. You can also attract new customers to your site by announcing PayPal acceptance.<br />
                            <em>TIP: You can find more PayPal logos and banners on <a href="https://www.paypal.com/gd/webapps/mpp/logo-center" target="_blank">PayPal Logo Center</a></em>
                            <br />
                        </p>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                <nop-override-store-checkbox asp-for="DisplayButtonsOnShoppingCart_OverrideForStore" asp-input="DisplayButtonsOnShoppingCart" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                <nop-label asp-for="DisplayButtonsOnShoppingCart" />
                            </div>
                            <div class="col-md-9">
                                <nop-editor asp-for="DisplayButtonsOnShoppingCart" />
                                <span asp-validation-for="DisplayButtonsOnShoppingCart"></span>
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                <nop-override-store-checkbox asp-for="DisplayButtonsOnProductDetails_OverrideForStore" asp-input="DisplayButtonsOnProductDetails" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                <nop-label asp-for="DisplayButtonsOnProductDetails" />
                            </div>
                            <div class="col-md-9">
                                <nop-editor asp-for="DisplayButtonsOnProductDetails" />
                                <span asp-validation-for="DisplayButtonsOnProductDetails"></span>
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                <nop-override-store-checkbox asp-for="DisplayLogoInHeaderLinks_OverrideForStore" asp-input="DisplayLogoInHeaderLinks" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                <nop-label asp-for="DisplayLogoInHeaderLinks" />
                            </div>
                            <div class="col-md-9">
                                <nop-editor asp-for="DisplayLogoInHeaderLinks" />
                                <span asp-validation-for="DisplayLogoInHeaderLinks"></span>
                            </div>
                        </div>
                        <nop-nested-setting asp-for="DisplayLogoInHeaderLinks">
                            <div class="form-group advanced-setting" id="pnlLogoInHeaderLinks">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="LogoInHeaderLinks_OverrideForStore" asp-input="LogoInHeaderLinks" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="LogoInHeaderLinks" />
                                </div>
                                <div class="col-md-9">
                                    <nop-textarea asp-for="LogoInHeaderLinks" />
                                    <span asp-validation-for="LogoInHeaderLinks"></span>
                                </div>
                            </div>
                        </nop-nested-setting>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                <nop-override-store-checkbox asp-for="DisplayLogoInFooter_OverrideForStore" asp-input="DisplayLogoInFooter" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                <nop-label asp-for="DisplayLogoInFooter" />
                            </div>
                            <div class="col-md-9">
                                <nop-editor asp-for="DisplayLogoInFooter" />
                                <span asp-validation-for="DisplayLogoInFooter"></span>
                            </div>
                        </div>
                        <nop-nested-setting asp-for="DisplayLogoInFooter">
                            <div class="form-group advanced-setting" id="pnlLogoInFooter">
                                <div class="col-md-3">
                                    <nop-override-store-checkbox asp-for="LogoInFooter_OverrideForStore" asp-input="LogoInFooter" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                                    <nop-label asp-for="LogoInFooter" />
                                </div>
                                <div class="col-md-9">
                                    <nop-textarea asp-for="LogoInFooter" />
                                    <span asp-validation-for="LogoInFooter"></span>
                                </div>
                            </div>
                        </nop-nested-setting>
                    </div>
                </div>
                <div class="form-group"></div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <input type="submit" name="save" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>